package com.snail.cloud.apis;

import com.snail.cloud.entities.PayDTO;
import com.snail.cloud.resp.ResultData;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 支付模块feign 接口
 *
 * @author snail
 * @date 2024/9/27
 */
@FeignClient("cloud-payment-service")
public interface PayFeignApi {

    /**
     * 添加支付
     *
     * @param payDTO 支付dto
     * @return {@link ResultData }
     * @author Snail
     * @date 2024/09/27
     */
    @PostMapping("/pay/add")
    ResultData addPay(@RequestBody PayDTO payDTO);

    /**
     * 删除支付
     *
     * @param id ID
     * @return {@link ResultData }
     * @author Snail
     * @date 2024/09/27
     */
    @DeleteMapping("/pay/delete/{id}")
    ResultData delPay(@PathVariable("id") Integer id);

    /**
     * 更新支付
     *
     * @param payDTO 支付dto
     * @return {@link ResultData }
     * @author Snail
     * @date 2024/09/27
     */
    @PutMapping("/pay/update")
    ResultData updatePay(@RequestBody PayDTO payDTO);

    /**
     * 获取支付信息，根据Id
     *
     * @param id 主键ID
     * @return {@link ResultData }
     * @author Snail
     * @date 2024/09/27
     */
    @GetMapping("/pay/get/{id}")
    ResultData getPayById(@PathVariable("id") Integer id);

    /**
     * 获取支付信息
     *
     * @return {@link ResultData }
     * @author Snail
     * @date 2024/09/27
     */
    @GetMapping("/pay/list")
    ResultData getPayList();

    /**
     * 获取 consult 配置信息，验证 LoadBalancer
     *
     * @return {@link String }
     * @author Snail
     * @date 2024/09/27
     */
    @GetMapping("/pay/info")
    String getInfo();

    /**
     * CircuitBreaker 测试
     *
     * @param id ID
     * @return {@link String }
     * @author Snail
     * @date 2024/09/29
     */
    @GetMapping("/pay/circuit/{id}")
    String myCircuit(@PathVariable("id") Integer id);


    /**
     * Micrometer（Sleuth）进行链路监控
     *
     * @param id ID
     * @return {@link String }
     * @author Snail
     * @date 2024/11/08
     */
    @GetMapping("/pay/micrometer/{id}")
    String myMicrometer(@PathVariable("id") Integer id);
}
